@extends('base')
@section('title', 'Home page')
@section('csses')
@endsection
@section('content')
<div>
    <div class="col-md-1"></div>
    <div class="col-md-10" style="margin-top: 40px;">
        <div style="font-size: 13px;">
            <b>Alerting Services</b><br><br>
                Our journal now offers four free and easy-to-use services designed to alert users as soon as new Web Edition content is published online. All methods ensure that you are alerted when new content that interests you becomes available.<br>
                <br>TOC Alert</font>: You can be alerted immediately when the entire contents of a new, complete issue is posted on the Web. <br>
                As Soon As Possible Published Alert</font>: You can be the first to know when an article is posted to the Web&mdash;either the every day it is published as an Article ASAP (As Soon As Publishable) or on a weekly basis.<br>
                Topic Alert</font>: You can be alerted immediately when the special topic contents of a new issue is posted on the Web. <br>
                Search Alert</font>: You can be alerted immediately when the articles of a new issue with the keywords you inputed is posted on the Web.
        </div>
        <div style="margin-top: 20px;">
            <form method="post" action="{{ route('alert.save') }}" >
                {{csrf_field()}}
                @if (session('status'))
                    <div class="alert alert-success">
                        {{ session('status') }}
                    </div>
                @endif 
                <div>
                <input type="checkbox" name="table_of_content" checked="checked" value="1"/>Table Of Content Alert
                </div>
                <div>
                <input type="checkbox" name="asap_published " value="1">As Soon As Possible Published Alert
                </div>
                <div>
                    <input type="checkbox" name="search_keywords" value="1">
                    Search Alert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Keyword:
                    <input type="text" name="keywords">
                     (Seperated by ";")
                </div>
                <div>
                    <input type="checkbox" name="high_light" value="1">
                    Highlight articles published in recent season
                </div>
                <div>
                    Please enter your main email. If you have more than online
                    emails, please order them one by one.
                </div>
                <div>
                    Email: <input type="email" name="email" required="required">
                    @if ($errors->has('email'))
                        <div class="alert alert-danger" style="padding:5px; margin-top: 10px;">
                            <strong>&nbsp;!</strong> {{ $errors->first('email') }}
                        </div>
                    @endif
                    <h2 style="color: red;">{{ Session::has('message') ? Session::get('message') : '' }}</h2>
                </div>
                <div style="margin-top: 20px;">
                    <div style="display: inline-block;">
                    Code: <input type="text" name="captcha"  style="width: 200px;" required="required">
                    </div>
                    <div style="display: inline-block; margin-left: 10px;">
                        <img height="30" src="{{url('email/alert/captcha/') . '/' . mt_rand() }}" alt="" class="captcha" >
                        <a href="#" id="captcha" style="margin-left:10px;">看不清图片，换一张</a>
                    </div>
                    
                    @if ($errors->has('captcha.*'))
                        <div class="alert alert-danger" style="padding:5px; margin-top: 10px;">
                            <strong>&nbsp;!</strong> {{ $errors->first('captcha.*') }}
                        </div>
                    @endif
                    
                </div>

                <div style="margin-top: 20px;margin-left: 320px;">
                    <input type="submit" name="Subscribe" value="Subscribe">
                </div>
            </form>
        </div>
    </div>
    <div class="col-md-1"></div>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
    $("#captcha").click(function(e){
        e.preventDefault();
        $url = "{{url('email/alert/captcha/') }}";
        $url = $url +"/"+ Math.random();
        $(".captcha").attr("src", $url);
    });
</script>
@endsection